/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 涛
 * Date: 2023-09-12
 * Time: 19:28
 */

//class B {
//    public B() {
//// do nothing
//        func();
//    }
//    public void func() {
//        System.out.println("B.func()");
//    }
//}
//class D extends B {
//    private int num = 1;
//    @Override
//    public void func() {
//        System.out.println("D.func() " + num);
//    }
//}
//    class Animal {
//        String name;
//        int age;
//
//        public void eat() {
//            System.out.println(this.name+"正在吃饭");
//        }
//
//        public Animal(String name, int age) {
//            this.name = name;
//            this.age = age;
//        }
//
//}
//
//class Dog extends Animal{
//        public void barks() {
//        System.out.println(this.name+"正在汪汪叫");
//    }
//    public void eat() {
//
//    }
//    public Dog(String name, int age) {
//        super(name,age);
//        this.name = name;
//        this.age = age;
//    }
//}

    class Shap {
        String s = "图形";

        public void print() {
            System.out.println("这是一个"+this.s);
        }
}

class Flower extends Shap {
        public void print() {
            System.out.println("❀");
        }
}

class Clce extends Shap {
    @Override
    public void print() {
        System.out.println("○");
    }
}

class Rect extends Shap {
    @Override
    public void print() {
        System.out.println("□");
    }
}

public class Test {

    public static void main(String[] args) {
//        Shap shap1 = new Flower();
//        Shap shap2 = new Clce();
//        Shap shap3 = new Rect();
//        shap1.print();
//        shap2.print();
//        shap3.print();
        Shap[] shaps = {new Flower(), new Clce(), new Rect()};

        for(Shap shap : shaps) {
            shap.print();
        }
    }


    public static void main2(String[] args) {
//        Dog dog = new Dog("圆圆",5);
//        dog.barks();
//        dog.eat();
//        dog.age = 15;
    }

    public static void main1(String[] args) {
        //D d = new D();
    }

}
